#include "StdAfx.h"
#include "Role.h"
#include "Card.h"
GRole LocalRole;
GRole::GRole(void)
{
	
}

GRole::~GRole(void)
{
	
}

GRole& GRole::GetLocalRole()
{
	return LocalRole;
}


DWORD GRole::GetRoleID()
{
	return m_dwRoleID;
}

void GRole::AddCard(int *a, int n)
{
	for (int i=0; i<n; i++)
		m_listCard.push_front(a[i]);
	m_listCard.sort();
}

void GRole::Draw(int w, int h)
{
	int nums = m_listCard.size();
	list<int>::reverse_iterator iter;
	int left = w/2-nums/2*15-75;
	int index = 0;	
	for (iter=m_listCard.rbegin(); iter != m_listCard.rend(); ++iter)
	{
		GCard::Inst().Draw(*iter, index*20+left, 20);
		index++;
	}
}

void GRole::DrawLeft(int w, int h)
{
	int nums = m_listCard.size();
	list<int>::reverse_iterator iter;
	int index = 0;	
	for (iter=m_listCard.rbegin(); iter != m_listCard.rend(); ++iter)
	{
		GCard::Inst().Draw(*iter, 150, h-200 - index*20);
		index++;
	}
}

void GRole::DrawRight(int w, int h)
{
	int nums = m_listCard.size();
	list<int>::reverse_iterator iter;
	int index = 0;	
	for (iter=m_listCard.rbegin(); iter != m_listCard.rend(); ++iter)
	{
		GCard::Inst().Draw(*iter, w-200, h-200 - index*20);
		index++;
	}
}